@extends('backend.layout.content')
@section('nav')
    <div class="col-lg-10">
        <h3>Basic Form</h3>
        <ol class="breadcrumb">
            <li>
                <a href="index.html">主页</a>
            </li>
            <li>
                <a>系统通知</a>
            </li>
            <li class="active">
                <strong>通知列表</strong>
            </li>
        </ol>
    </div>
@endsection
@section('content')
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-content">
                    <div class="row">
                        <div class="col-sm-9">
                            <a href="javascript:;" class="btn btn-primary btn-refresh"
                               onclick="window.location.reload();"><i class="fa fa-refresh"></i></a>
                            <a href="notices/create" class="btn btn-success btn-add"><i
                                        class="fa fa-plus"></i> 添加</a>
                            <a href="javascript:;" class="btn btn-danger btn-del"><i class="fa fa-trash"></i> 批量删除</a>
                        </div>
                        <div class="col-sm-3">
                            <form action="/{{admin_prefix()}}/notices" method="get">
                                <div class="input-group">
                                    <input type="text" placeholder="请输入用户名" name="key" class="input-sm form-control">
                                    {{csrf_field()}}
                                    <span class="input-group-btn">
                                        <button type="submit" class="btn btn-sm btn-primary"> 搜索</button>
                                    </span>
                                </div>
                            </form>
                    </div>
                </div>
                <div class="table-responsive">
                    <table class="table  table-bordered table-hover">
                        <thead>
                        <tr>
                            <th><input class="i-checks checkbox check-all" type="checkbox"></th>
                            <th>ID</th>
                            <th>通知标题</th>
                            <th>通知内容</th>
                            <th>创建时间</th>
                            <th>更新时间</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody>

                        @foreach($notices as $notice)
                            <tr>
                                <td><input class="ids i-checks" type="checkbox" name="ids[]" value="{{$notice->id}}">
                                </td>
                                <td>{{$notice->id}}</td>
                                <td>{{$notice->title}}</td>
                                <td>{{str_limit($notice->content,20,'...')}}</td>
                                <td>{{$notice->created_at}}</td>
                                <td>{{$notice->updated_at}}</td>
                                <td>
                                    <a href="{{route('admin::notices.edit',[$notice->id])}}" class="btn btn-primary btn-xs" title="编辑">
                                        <i class="fa fa-pencil-square-o"></i>
                                    </a>
                                    <a href="javascript:;" class="btn btn-danger btn-xs" title="删除"
                                       onclick="delBtn('notices/delete',this)"
                                       data-id="">
                                        <i class="fa fa-trash-o"></i>
                                    </a>


                                </td>
                            </tr>
                        @endforeach
                        </tbody>
                    </table>
                    <div class="pull-left">
                        <span class="pagination-info">
                            显示第 {{$notices->firstItem()}} 到第 {{$notices->lastItem()}}条记录，
                            总共 {{$notices->total()}} 条记录
                        </span>
                    </div>
                    <div class="pull-right pagination">
                        {{$notices->appends(['key'=>$key])->links()}}
                    </div>

                </div>
            </div>
        </div>
    </div>
    </div>
@endsection
@section('js')
<!-- iCheck -->
<script src="/backend/js/plugins/iCheck/icheck.min.js"></script>
<script src="/backend/js/table.js"></script>
<script>
var _url="notices/delete";
</script>
@endsection